package com.bw.login

import android.graphics.Bitmap
import android.os.Bundle
import android.view.View
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.bw.common.mvi.BaseMviActivity
import com.bw.login.databinding.ActivityWebBinding

class WebActivity : BaseMviActivity<ActivityWebBinding>() {


    override fun getLayoutId(): Int {
        return R.layout.activity_web
    }

    override fun initViews() {
        //进入时有进度条
        mDataBinding.progressBar.visibility = View.VISIBLE
        mDataBinding.webview.loadUrl("https://www.douyin.com/draft/douyin_agreement/douyin_agreement_privacy.html?id=6773901168964798477")

        mDataBinding.webview.settings.javaScriptEnabled = true
        mDataBinding.webview.webViewClient = object : WebViewClient() {
            override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
                super.onPageStarted(view, url, favicon)
                mDataBinding.progressBar.visibility = View.VISIBLE
            }

            override fun onPageFinished(view: WebView?, url: String?) {
                super.onPageFinished(view, url)
                mDataBinding.progressBar.visibility = View.GONE
            }
        }
    }
}